package com.tjetc.字节流;

import java.io.*;

public class T03字节流的文件拷贝 {
    public static void main(String[] args) throws IOException {
        //开管
//        FileInputStream fileInputStream = new FileInputStream(new File("myfile"));
//        FileOutputStream fileOutputStream = new FileOutputStream(new File("myfile"));
        FileInputStream fileInputStream = new FileInputStream(new File("1.jpg"));
        FileOutputStream fileOutputStream = new FileOutputStream(new File("11.jpg"));
        byte[]bytes=new byte[1024];
        int num;
        while ((num=fileInputStream.read(bytes))!=-1){
            fileOutputStream.write(bytes,0,num);
        }
        //关管
        fileOutputStream.close();
        fileInputStream.close();
    }
}
